package cn.edu.xmu.oomall.liquidation.model.bo;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;
import java.time.ZonedDateTime;
import java.util.HashMap;
import java.util.Map;

/**
 * @author liuhezhao
 * @version 2021/12/4 11:40
 * @package_name cn.edu.xmu.oomall.liquidation.model.bo
 * @project_name oomall
 * @product_name IntelliJ IDEA
 * @description
 */

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Liquidation {
    public enum State {
        NOT_EXPORT(0, "未汇出"),
        EXPORT(1, "已汇出");

        private static final Map<Integer, State> stateMap;
        private int code;
        private String description;

        static {
            stateMap = new HashMap<>();
            for (State state : State.values()) {
                stateMap.put(state.code, state);
            }
        }

        State(int code, String description) {
            this.code = code;
            this.description = description;
        }

        public static State getTypeByCode(Integer code) {
            return stateMap.get(code);
        }

        public Integer getCode() {
            return code;
        }

        public String getDescription() {
            return description;
        }
    }
    private Long id;
    private Long shopId;

    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ", timezone = "GMT+8")
    private LocalDateTime liquidDate;
    private Long expressFee;
    private Long commission;
    private Long point;
    private Byte state;
    private Long shopRevenue;
    private Long creatorId;
    private String createName;
    private Long modifierId;
    private String modifierName;
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ", timezone = "GMT+8")
    private LocalDateTime gmtCreated;
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ", timezone = "GMT+8")
    private LocalDateTime gmtModified;

}
